$(function () {
    findAll()
})
function findAll() {
    let data=myAjax("/back/navigation/navigationFindAll","","get");
    setData(data.list);
}
function setData(data) {
    let html='';
    for (let i=0;i<data.length;i++){
        html +='   <tr>\n' +//字符串拼接
            '            <td>'+data[i].id+'</td>\n' +
            '            <td>'+data[i].name+'</td>\n' +
            '            <td>'+data[i].connection+'</td>\n' +
            '            <td>'+data[i].isShow+'</td>\n' +
            '            <td><input type="button" value="编辑" onclick="updatabyid('+data[i].id+')"> <a href="javascript:deletebyId('+data[i].id+')">删除</a></td>\n' +
            '        </tr>';
    }
    $("#productFindAll").html(html);
}

// '        <select>\n' +
// '            <option name="isShow" value="1">显示</option>\n' +
// '            <option name="isShow" value="0">隐藏</option> \n' +
// '        </select>\n' +


function updatabyid(id) {
    localStorage.setItem("navigationId",id);
    $('#reght').load('/back/navigation/navigationUpdate.html');
}


function deletebyId(id) {
    let data=myAjax("/back/navigation/navigationDeleteById",{id:id},"post");
    if (data.count==1){
        alert("删除成功");
        findAll();
    } else {
        alert("删除失败");
    }
}